package xyz.coolcsm.security.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import xyz.coolcsm.security.entity.Say;

import java.util.List;
/**
 * @author 什锦
 * @since 2021-06-1
 */
@Mapper
@Repository
public interface SayMapper extends BaseMapper<Say> {

    @Select("SELECT * FROM `sys_say` AS a WHERE DATE_FORMAT(a.create_time, '%Y%m') = #{time} ORDER BY `create_time` DESC;")
    List<Say> listByMonth(@Param("time") String time);

    @Select("SELECT * FROM `sys_say` AS a WHERE DATE_FORMAT(a.create_time, '%Y') = #{time} ORDER BY `create_time` DESC;")
    List<Say> listByYear(@Param("time") String time);

}
